package com.hp.activiti.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.hp.activiti.bean.Result;
import com.hp.activiti.model.MenuInfo;
import com.hp.activiti.service.MenuService;

/**
 * @Description:权限(菜单)管理
 * @author hp
 * @date 2018年5月20日 上午10:26:25
 */
@RestController
@RequestMapping(value="/menu")
public class MenuController {
	
	@Autowired
	private MenuService menuService;
	
	
	/***
	 * 获取所有的菜单tree
	 * @return
	 */
	@PostMapping("/allTreeMenu")
	@ResponseBody
	public List<MenuInfo> allTreeMenu(){
		return menuService.allTreeMenu();
	}
	
	
	/**
	 * 保存菜单(新增修改通用)
	 * @param code 用户部门编号
	 * @return
	 */
	@PostMapping(value="/saveMenu",produces="application/json;charset=UTF-8")
	@ResponseBody
	public Result saveMenu(@RequestBody MenuInfo menu){
		return menuService.saveMenu(menu);
	}
	
}
